#include<bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
const int nmax = 1005;
const int INF = 0x3f3f3f3f;
const ull p = 233;
const ull mod = 1e9+7;
int lentext,lenstr;
ull texthash[nmax],strhash[nmax],P[nmax];
char text[nmax],str[nmax];
inline void gethash(){
    texthash[1] = text[1], strhash[1] = str[1];
    for(int i = 2;i<=lentext;++i) texthash[i] = (texthash[i-1] * p + text[i])%mod;
    for(int i = 2;i<=lenstr;++i) strhash[i] = (strhash[i-1] * p + str[i])%mod;

}
inline ull subhash(int l,int r){
	printf("%d\n",r-l+1);
	printf("%d\n",P[r-l+1]);
    return texthash[r] - (texthash[l-1] * P[r-l+1])%mod;
    
}
int main(){
    P[1] = p;
    for(int i = 2;i<=1001;++i)
	{
		P[i] = P[i-1] * p;
		printf("%d\n",P[i]);
	} 
    while(scanf("%s",text+1)){
        if(text[1] == '#') break;
        scanf("%s",str+1);
        lentext = strlen(text+1), lenstr = strlen(str+1);
        gethash();
        int l = 1,ans=0;
        while(1){
            int r = l+lenstr-1;
            if(subhash(l,r) == strhash[lenstr]){
                ans++;
                l = r+1;
            }else l++;
            if(l>lentext - lenstr+1) break;
        }
        printf("%d\n",ans);
    }
    return 0;
}

